package com.lcd.ssm.web.controller;

import com.lcd.ssm.domain.Menu;
import com.lcd.ssm.service.IMenuService;
import com.lcd.ssm.util.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class MenuController {
    @Autowired
    private IMenuService menuService;

    @RequestMapping("/queryForRoot")
    @ResponseBody
    public List<Menu> queryForRoot(HttpServletRequest request){
        //用户登录把菜单放到session 从session那
        List<Menu> menus = (List<Menu>) request.getSession().getAttribute(UserContext.MENU_SESSION);
        return menus;
    }
}
